import { defHttp } from '/@/utils/http/axios';
import {  WebsiteBannerModel, WebsiteBannerTableRecordModel } from '../model/websiteBannerModel';
import { ErrorMessageMode } from "/#/axios";

enum Api {
  WEBSITEBANNER_PAGE = '/jxxhWebsite/websiteBanner/getBannerVosPage',
  GET_WEBSITEBANNERVO_BY_ID = '/jxxhWebsite/websiteBanner/',
  WEBSITEBANNERVO_SAVE = '/jxxhWebsite/websiteBanner/save',
  WEBSITEBANNERVO_UPDATE = '/jxxhWebsite/websiteBanner/updateById',
  WEBSITEBANNERVO_REMOVE = '/jxxhWebsite/websiteBanner/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const websiteBannerListApi = (params: Object) =>
  defHttp.get<WebsiteBannerTableRecordModel>(
    {url: Api.WEBSITEBANNER_PAGE,params },
    { errorMessageMode: 'message' }
  );

export const getWebsiteBannerVoByIdApi = (id) =>
  defHttp.get<WebsiteBannerModel>(
    {url: Api.GET_WEBSITEBANNERVO_BY_ID+id },
    { errorMessageMode: 'message' }
  );

export function websiteBannerSaveApi(params: WebsiteBannerModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<WebsiteBannerModel>(
    {
      url: Api.WEBSITEBANNERVO_SAVE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function websiteBannerUpdateApi(params: WebsiteBannerModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.put<WebsiteBannerModel>(
    {
      url: Api.WEBSITEBANNERVO_UPDATE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export const logicalRemoveById = (id) =>
  defHttp.delete<WebsiteBannerModel>(
    {url: Api.WEBSITEBANNERVO_REMOVE+id },
    { errorMessageMode: 'message' }
  );
